package com.mrx.giteewebhook.constants;

import com.mrx.giteewebhook.model.Pair;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;

/**
 * @author Mr.X
 * @since 2024-03-08 13:39
 **/
public class GiteeWebhookConstants {

    // 默认为 application/json , 若是旧版钩子(已不维护)为 application/x-www-form-urlencoded
    public static final Pair<String, String> CONTENT_TYPE = Pair.of(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);

    // 固定为 git-oschina-hook，可用于标识为来自 gitee 的请求
    public static final Pair<String, String> USER_AGENT = Pair.of(HttpHeaders.USER_AGENT, "git-oschina-hook");

    // 用户新建 WebHook 时提供的密码或根据提供的签名密钥计算后的签名
    public static final String X_GITEE_TOKEN = "X-Gitee-Token";

    // 触发 WebHook 的时间戳
    public static final String X_GITEE_TIMESTAMP = "X-Gitee-Timestamp";

    // 标识触发的钩子类型
    public static final String X_GITEE_EVENT = "X-Gitee-Event";
}
